The
vizact.method interface allows creating actions to call any method of an object as an action. Simply replace
[name] with the name of the method to call along with the arguments to pass.
This action supports
<vizact>.mix parameters. When mix parameters are used, the specified function will be called until the mix parameter completes. This is useful for animating arbitrary commands.
Example 1:
# Toggle visibility every 0.5 seconds
ToggleVisible = vizact.sequence( [vizact.waittime(0.5), vizact.method.visible(viz.TOGGLE)], viz.FOREVER)
node.addAction(ToggleVisible)
Example 2:import viz
import vizact
viz.go()
# Add 3D text
text = viz.addText3D('WorldViz',pos=(0,1.5,6),color=viz.ORANGE)
text.alignment(viz.ALIGN_CENTER)
# Add spinning action on pool 1
text.addAction( vizact.spin(0,1,0,20), pool=1 )
# Create actions to animate thickness
thick = vizact.method.setThickness( vizact.mix(0.1, 1.0, time=1.0) )
thin = vizact.method.setThickness( vizact.mix(1.0, 0.1, time=1.0) )
# Cycle thick/thin actions on pool 2
text.addAction( vizact.sequence( thick, thin, viz.FOREVER ), pool = 2 )